<?php
/* $Id: view.assets.php,v 1.7 2003/10/08 07:15:12 tuxmonkey Exp $ */
/**
 * @package Issue-Tracker
 * @subpackage assets
 */

if (strpos($_SERVER['PHP_SELF'],basename(__FILE__)) !== false) {
  print "Direct module access forbidden.".basename(__FILE__);exit;}
  

if (!is_employee() or !asset_exists($_GET['aid'])) {
  redirect();
}

// Make sure to clean the wizard session variable
// or it could cause a nasty loop
unset($_SESSION['asset_WIZARD']);

// from query to pull asset info
$sql  = "SELECT * ";
$sql .= "FROM z_assets ";
$sql .= "WHERE aid='".$_GET['aid']."'";
$asset = $dbi->fetch_row($sql,"array");
if (is_null($asset)) {
  redirect();
}
$smarty->assign('asset',$asset);

$links[] = array(
  "txt" => "Back",
  "url" => "?module=assets",
  "img" => $_ENV['imgs']['back']
);
      
  $links[] = array(
    "txt"   => "Edit Information",
    "url"   => "?module=assets&action=edit_info&aid=".$_GET['aid'],
    "img" => $_ENV['imgs']['edit']
  );

  $links[] = array(
    "txt"   => "Voir log",
    "url"   => "?module=assets&action=view_log&aid=".$_GET['aid'],
    "img" => $_ENV['imgs']['issue_log']
  );

  $links[] = array(
    "txt"   => "Voir notes",
    "url"   => "?module=assets&action=issues&aid=".$_GET['aid'],
    "img" => $_ENV['imgs']['motd']
  );

$users = asset_users($_GET['aid']);
$all_users = group_members($asset['gid']);
$smarty->assign('users',$users);
$smarty->assign('all_users',$all_users);
$smarty->display("assets/view.tpl");
?>